function myCall (contect, ...args) {
    return this.call(contect, ...args)
}
Function.prototype.myCall = myCall;


function myApply (contect, args) {
    return this.call(contect, ...args);
}
Function.prototype.myApply = myApply;


function myBind (contect, ...args) {
    // 返回一个函数，修改this指向
    return (...rest) => {
        this.call(contect, ...args, ...rest)
    }
}
Function.prototype.myBind = myBind;

function foo (a, b, c) {
    console.log(a, b, c)
    console.log(this.a)
}

var obj = {a: 1}

foo.myBind(obj, 1, 2)(3)
foo.myApply(obj, [2, 4, 3])
foo.myCall(obj, 5, 6, 7)